package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TCdgnwzdsj;
import com.ruoyi.system.service.ITCdgnwzdsjService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 承担国内外重大设计与展演任务Controller
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/cdgnwzdsj")
public class TCdgnwzdsjController extends BaseController
{
    @Autowired
    private ITCdgnwzdsjService tCdgnwzdsjService;

    /**
     * 查询承担国内外重大设计与展演任务列表
     */
    @PreAuthorize("@ss.hasPermi('system:cdgnwzdsj:list')")
    @GetMapping("/list")
    public TableDataInfo list(TCdgnwzdsj tCdgnwzdsj)
    {
        startPage();
        List<TCdgnwzdsj> list = tCdgnwzdsjService.selectTCdgnwzdsjList(tCdgnwzdsj);
        return getDataTable(list);
    }

    /**
     * 导出承担国内外重大设计与展演任务列表
     */
    @PreAuthorize("@ss.hasPermi('system:cdgnwzdsj:export')")
    @Log(title = "承担国内外重大设计与展演任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TCdgnwzdsj tCdgnwzdsj)
    {
        List<TCdgnwzdsj> list = tCdgnwzdsjService.selectTCdgnwzdsjList(tCdgnwzdsj);
        ExcelUtil<TCdgnwzdsj> util = new ExcelUtil<TCdgnwzdsj>(TCdgnwzdsj.class);
        util.exportExcel(response, list, "承担国内外重大设计与展演任务数据");
    }

    /**
     * 获取承担国内外重大设计与展演任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:cdgnwzdsj:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tCdgnwzdsjService.selectTCdgnwzdsjById(id));
    }

    /**
     * 新增承担国内外重大设计与展演任务
     */
    @PreAuthorize("@ss.hasPermi('system:cdgnwzdsj:add')")
    @Log(title = "承担国内外重大设计与展演任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TCdgnwzdsj tCdgnwzdsj)
    {
        return toAjax(tCdgnwzdsjService.insertTCdgnwzdsj(tCdgnwzdsj));
    }

    /**
     * 修改承担国内外重大设计与展演任务
     */
    @PreAuthorize("@ss.hasPermi('system:cdgnwzdsj:edit')")
    @Log(title = "承担国内外重大设计与展演任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCdgnwzdsj tCdgnwzdsj)
    {
        return toAjax(tCdgnwzdsjService.updateTCdgnwzdsj(tCdgnwzdsj));
    }

    /**
     * 删除承担国内外重大设计与展演任务
     */
    @PreAuthorize("@ss.hasPermi('system:cdgnwzdsj:remove')")
    @Log(title = "承担国内外重大设计与展演任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tCdgnwzdsjService.deleteTCdgnwzdsjByIds(ids));
    }
}
